Capturing Joystick Input

Most of the code controlling the joystick is in the main window function. In the following portion of the message handler, the application calls joySetCapture13794CD to capture input from the joystick JOYSTICKID1.

case WM_CREATE:

    if(joySetCapture(hWnd, JOYSTICKID1, NULL, FALSE))

   

        MessageBeep(MB_ICONEXCLAMATION);

        MessageBox(hWnd, "Couldn't capture the joystick.", NULL,

            MB_OK | MB_ICONEXCLAMATION);

        PostMessage(hWnd,WM_CLOSE,0,0L);

    }

    break;